package com.ruoyi.web.controller.check;

import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.check.domain.ECheckListFormAl;
import com.ruoyi.check.service.IECheckListFormAlService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 配置平台Controller
 *
 * @author hugh.sun
 * @date 2023-04-19
 */
@RestController
@RequestMapping("/check/al")
public class ECheckListFormAlController extends BaseController
{
    @Autowired
    private IECheckListFormAlService eCheckListFormAlService;

    /**
     * 查询配置平台列表
     */
    @PreAuthorize("@ss.hasPermi('check:al:list')")
    @GetMapping("/list")
    public TableDataInfo list(ECheckListFormAl eCheckListFormAl)
    {
        startPage();
        List<ECheckListFormAl> list = eCheckListFormAlService.selectECheckListFormAlList(eCheckListFormAl);
        return getDataTable(list);
    }

    /**
     * 导出配置平台列表
     */
    @PreAuthorize("@ss.hasPermi('check:al:export')")
    @Log(title = "配置平台", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ECheckListFormAl eCheckListFormAl)
    {
        ArrayList<String> strings = new ArrayList<>();
        strings.add("bu");
        strings.add("hhhh");
        strings.add("this is here have");
        strings.add("this is here ");
        List<ECheckListFormAl> list = eCheckListFormAlService.selectECheckListFormAlList(eCheckListFormAl);
        ExcelUtil<ECheckListFormAl> util = new ExcelUtil<ECheckListFormAl>(ECheckListFormAl.class);
        util.exportExcel(response, list, "配置平台数据");
    }

    /**
     * 获取配置平台详细信息
     */


    @PreAuthorize("@ss.hasPermi('check:al:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        ArrayList<Long> longs = new ArrayList<>();
        longs.add(50L);
        return success(eCheckListFormAlService.selectECheckListFormAlById(id));
    }

    /**
     * 新增配置平台
     */
    @PreAuthorize("@ss.hasPermi('check:al:add')")
    @Log(title = "配置平台", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ECheckListFormAl eCheckListFormAl)
    {
        return toAjax(eCheckListFormAlService.insertECheckListFormAl(eCheckListFormAl));
    }

    /**
     * 修改配置平台
     */
    @PreAuthorize("@ss.hasPermi('check:al:edit')")
    @Log(title = "配置平台", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ECheckListFormAl eCheckListFormAl)
    {
        return toAjax(eCheckListFormAlService.updateECheckListFormAl(eCheckListFormAl));
    }

    /**
     * 删除配置平台
     */
    @PreAuthorize("@ss.hasPermi('check:al:remove')")
    @Log(title = "配置平台", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(eCheckListFormAlService.deleteECheckListFormAlByIds(ids));
    }
}
